ConfigPriv=1;
DigitaloutputPriv=1;

function loadCurrentSetting()
{
	document.title=system_hostname;
	document.getElementById("page_title").innerHTML=system_hostname;
	if (ConfigPriv == 0)
	{
		document.getElementById("config_icon").style.display = "none";
	}
	if (DigitaloutputPriv == 0)
	{
		document.getElementById("digitaloutput_icon").style.display = "none";
	}
	loadlanguage();
	loadvalue();
	ShowPresetSelction();
	if(typeof(RtspVapgCtrl)!="undefined")
		SetPluginString(RtspVapgCtrl);
}

function changlan(lan)
{
	document.getElementById("button").style.display="none";
	var expires = new Date();
	expires.setTime (expires.getTime() + (10 * 365 * 24 * 60 * 60 * 1000));
	setCookie("lan", lan, expires);
	location.reload();
}

function showlanguage()
{
	if(document.getElementById("button").style.display=="block")
		document.getElementById("button").style.display="none";
	else
		document.getElementById("button").style.display="block";
}

function MM_swapImgRestore() { 
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { 
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}
 
function MM_swapImage() { 
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function SubmitPanspeed(selObj) {  
  for (var i=0; i < selObj.options.length; i++)
    if (selObj.options[i].selected)
      break;
  parent.retframe.location.href='/cgi-bin/viewer/camctrl.cgi?speedpan='+(i-5)  
}

function SubmitTiltspeed(selObj) {  
  for (var i=0; i < selObj.options.length; i++)
    if (selObj.options[i].selected)
      break;
  parent.retframe.location.href='/cgi-bin/viewer/camctrl.cgi?speedtilt='+(i-5)  
}

function SubmitZoomspeed(selObj) {  
  for (var i=0; i < selObj.options.length; i++)
    if (selObj.options[i].selected)
      break;
  parent.retframe.location.href='/cgi-bin/viewer/camctrl.cgi?speedzoom='+(i-5)  
}

function ShowPresetSelction()
{
	var list=document.getElementById("presetname");
	
	for (var i = 0; i < 20; i++)
	{
		var PreName = eval('camctrl_c0_preset_i' + i + '_name');
		
		if (PreName != "")
		{
			list.options[++list.length-1].text=PreName;
			list.options[list.length-1].value=PreName;
		}	
	}
}

function SubmitPreset(selObj) {	
  	for (var i=0; i < selObj.options.length-1; i++)
    	if (selObj.options[i].selected)
      	break;
  	if (selObj.options[i].value == -1) return;
  
  	parent.retframe.location.href='/cgi-bin/viewer/recall.cgi?recall=' + escape(selObj.options[i].text);
}
